import request from '@/axios'
import { SysMachineInfoDetailVo, SysMachineInfoEditQo, SysMachineInfoListVo, SysMachineInfoSearchQo } from './types'
import { BaseDeleteQo } from '@/base/api/BaseQo'
import { KeyLabelValueVo } from '@/base/api/KeyLabelValueVo'

export const sysMachineInfoPageApi = (data: SysMachineInfoSearchQo): Promise<IResponse<Array<SysMachineInfoListVo>>> => {
  return request.post({ url: '/sysMachineInfo/page.adw', data })
}

export const sysMachineInfoDetailApi = (id: number): Promise<IResponse<SysMachineInfoDetailVo>> => {
  const data = { id }
  return request.post({
    url: '/sysMachineInfo/detail.adw',
    data
  })
}

export const sysMachineInfoAddApi = (data: SysMachineInfoEditQo): Promise<IResponse<number>> => {
  return request.post({ url: '/sysMachineInfo/add.adw', data })
}

export const sysMachineInfoUpdateApi = (data: SysMachineInfoEditQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysMachineInfo/update.adw', data })
}

export const sysMachineInfoDeleteApi = (data: BaseDeleteQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysMachineInfo/delete.adw', data })
}

// [[ OnflowGenerator Range (- selectFunctions -) Start ]]
export const selectSysMachineInfoMachineIdListApi = (
  data: SysMachineInfoSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysMachineInfo/selectMachineIdList.adw', data })
}
// [[ OnflowGenerator Range (- selectFunctions -) End ]]
